﻿<UserControl x:Class="Probel.Ldoc.Views.Controls.PatientView"
             
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:conv="clr-namespace:Probel.Ldoc.Views.Converters"
             xmlns:t="clr-namespace:Probel.Ldoc.Views.Properties"
             xmlns:ctrl="clr-namespace:Probel.Ldoc.Views.Controls"
             
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="600">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <conv:BytesToImageConverter x:Key="bytesToImage"/>
                    <conv:BirthdateToAgeConverter x:Key="birthdateToAge"/>
                    <BooleanToVisibilityConverter x:Key="boolToVisibility"/>
                    <Style TargetType="TextBlock">
                        <Setter Property="Margin" Value="5"/>
                        <Setter Property="FontSize" Value="12"/>
                    </Style>
                </ResourceDictionary>
                <ResourceDictionary Source="../Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <!--<Grid.Style>
            <Style TargetType="{x:Type Grid}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=DataContext, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
                        <Setter Property="Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </Grid.Style>-->
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <DockPanel>
            <Border DockPanel.Dock="Top" 
                    BorderThickness="5"
                    CornerRadius="5"
                    Background="#FF465A7D"
                    Height="250" 
                    HorizontalAlignment="Stretch"                
                    VerticalAlignment="Top"
                    Margin="0,0,0,0">
                <Border.Effect>
                    <DropShadowEffect Color="#FFB6B6B6"/>
                </Border.Effect>
                <HeaderedContentControl Header="{x:Static t:Messages.Gb_Photo}">
                    <Image Stretch="None">
                        <Image.Source>
                            <Binding Path="Thumbnail"
                                     Converter="{StaticResource bytesToImage}">
                                <Binding.TargetNullValue>
                                    <ImageSource>/Probel.Ldoc.Views;component/Images/PatientData.png</ImageSource>
                                </Binding.TargetNullValue>
                            </Binding>
                        </Image.Source>
                    </Image>
                </HeaderedContentControl>
            </Border>
            <Border DockPanel.Dock="Top" 
                    BorderThickness="5"
                    CornerRadius="5"
                    Background="#FF465A7D"
                    MinHeight="150" 
                    HorizontalAlignment="Stretch"                
                    VerticalAlignment="Top"
                    Margin="0,0,0,0">
                <Border.Effect>
                    <DropShadowEffect Color="#FFB6B6B6"/>
                </Border.Effect>
                <HeaderedContentControl Header="{x:Static t:Messages.Gb_SearchTags}">
                    <ScrollViewer VerticalScrollBarVisibility="Auto">
                        <ItemsControl ItemsSource="{Binding SearchTags}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <DockPanel>
                                        <Image Source="/Probel.Ldoc.Views;component/Images/Tag.png"
                                           Width="24" Height="24"/>
                                        <TextBlock Text="{Binding Name}" VerticalAlignment="Center"/>
                                    </DockPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </HeaderedContentControl>
            </Border>
            <Label/>
        </DockPanel>
        <ScrollViewer Grid.Column="1"
                      VerticalScrollBarVisibility="Auto">
            <DockPanel>
                <Border DockPanel.Dock="Top"
                    BorderThickness="5"
                    CornerRadius="5"
                    Background="#FF465A7D">
                    <Border.Effect>
                        <DropShadowEffect Color="#FFB6B6B6"/>
                    </Border.Effect>
                    <HeaderedContentControl Header="{x:Static t:Messages.Gb_Patient}">
                        <ScrollViewer HorizontalScrollBarVisibility="Auto"
                                      VerticalScrollBarVisibility="Disabled">
                            <DockPanel DockPanel.Dock="Top">
                                <TextBlock DockPanel.Dock="Top">
                                <Run Text="{x:Static t:Messages.Lbl_Patient}"/>
                                <Run Text="{Binding FirstName}" FontWeight="Bold"/>
                                <Run Text="{Binding LastName}" FontWeight="Bold"/>
                                <Run Text="("/>
                                <Run Text="{Binding Fee}" FontWeight="Bold" Foreground="Red"/>
                                <Run Text="€" FontWeight="Bold" Foreground="Red"/>
                                <Run Text=")"/>
                                </TextBlock>
                                <TextBlock DockPanel.Dock="Top">
                                    <Run Text="{x:Static t:Messages.Lbl_Dob}"/>
                                    <Run Text="{Binding Birthdate, StringFormat=D}" FontWeight="Bold"/>
                                    <Run Text="{x:Static t:Messages.Lbl_In}"/>
                                    <Run Text="{Binding PlaceOfBirth}" FontWeight="Bold"/>
                                    <Run Text="("/>
                                    <Run Text="{Binding BirthDate, Converter={StaticResource birthdateToAge}}" FontWeight="Bold"/>
                                    <Run Text="{x:Static t:Messages.Lbl_YearOld}"/>
                                    <Run Text=")"/>
                                </TextBlock>
                                <TextBlock DockPanel.Dock="Top">
                                    <Run Text="{x:Static t:Messages.Lbl_Profession}"/>
                                    <Run Text="{Binding Profession}" FontWeight="Bold"/>
                                </TextBlock>
                                <TextBlock DockPanel.Dock="Top">
                                    <Run Text="{x:Static t:Messages.Lbl_Insurance}"/>
                                    <Run Text="{Binding Insurance}" FontWeight="Bold"/>
                                </TextBlock>
                                <TextBlock DockPanel.Dock="Top">
                                    <Run Text="{x:Static t:Messages.Lbl_Practice}"/>
                                    <Run Text="{Binding Practice}" FontWeight="Bold"/>
                                </TextBlock>
                            </DockPanel>
                        </ScrollViewer>
                    </HeaderedContentControl>
                </Border>

                <Border DockPanel.Dock="Top"
                    BorderThickness="5"
                    CornerRadius="5"
                    Background="#FF465A7D">
                    <Border.Effect>
                        <DropShadowEffect Color="#FFB6B6B6"/>
                    </Border.Effect>
                    <HeaderedContentControl Header="{x:Static t:Messages.Gb_Address}">
                        <ScrollViewer HorizontalScrollBarVisibility="Auto"
                                      VerticalScrollBarVisibility="Disabled">
                            <StackPanel>
                                <TextBlock>
                            <Run Text="{Binding Address.Street}"/>
                            <Run Text=","/>
                            <Run Text="{Binding Address.StreetNumber}"/>
                            <Run Text="{Binding Address.BoxNumber}"/>
                                </TextBlock>
                                <TextBlock>
                            <Run Text="{Binding Address.PostalCode}"/>
                            <Run Text="{Binding Address.City}"/>
                                </TextBlock>
                            </StackPanel>
                        </ScrollViewer>
                    </HeaderedContentControl>
                </Border>

                <Border DockPanel.Dock="Top"
                    BorderThickness="5"
                    CornerRadius="5"
                    Background="#FF465A7D">
                    <Border.Effect>
                        <DropShadowEffect Color="#FFB6B6B6"/>
                    </Border.Effect>
                    <HeaderedContentControl Header="{x:Static t:Messages.Gb_Contact}">
                        <ScrollViewer HorizontalScrollBarVisibility="Auto"
                                      VerticalScrollBarVisibility="Disabled">
                            <StackPanel>
                                <GroupBox Header="{x:Static t:Messages.Gb_Private}">
                                    <StackPanel>
                                        <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_Phone}"/>
                            <Run Text="{Binding PrivatePhone}" FontWeight="Bold"/>
                                        </TextBlock>
                                        <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_Mobile}"/>
                            <Run Text="{Binding PrivateMobile}" FontWeight="Bold"/>
                                        </TextBlock>
                                        <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_Email}"/>
                            <Run Text="{Binding PrivateMail}" FontWeight="Bold"/>
                                        </TextBlock>
                                    </StackPanel>
                                </GroupBox>

                                <GroupBox Header="{x:Static t:Messages.Gb_Professinal}">
                                    <StackPanel>
                                        <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_Phone}"/>
                            <Run Text="{Binding ProPhone}" FontWeight="Bold"/>
                                        </TextBlock>
                                        <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_Mobile}"/>
                            <Run Text="{Binding ProMobile}" FontWeight="Bold"/>
                                        </TextBlock>
                                        <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_Email}"/>
                            <Run Text="{Binding ProMail}" FontWeight="Bold"/>
                                        </TextBlock>
                                    </StackPanel>
                                </GroupBox>
                            </StackPanel>
                        </ScrollViewer>
                    </HeaderedContentControl>
                </Border>

                <Border DockPanel.Dock="Top"
                    BorderThickness="5"
                    CornerRadius="5"
                    Background="#FF465A7D">
                    <Border.Effect>
                        <DropShadowEffect Color="#FFB6B6B6"/>
                    </Border.Effect>
                    <HeaderedContentControl Header="{x:Static t:Messages.Gb_Misc}">
                        <StackPanel>
                            <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_Inscription}"/>
                            <Run Text="{Binding InscriptionDate,StringFormat=D}" FontWeight="Bold"/>
                            </TextBlock>
                            <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_LastUpdate}"/>
                            <Run Text="{Binding LastUpdate,StringFormat=D}" FontWeight="Bold"/>
                            </TextBlock>
                            <TextBlock>
                            <Run Text="{x:Static t:Messages.Lbl_Reputation}"/>
                            <Run Text="{Binding Reputation}" FontWeight="Bold"/>
                            </TextBlock>
                        </StackPanel>
                    </HeaderedContentControl>
                </Border>
                <TextBlock/>
            </DockPanel>
        </ScrollViewer>
        <DockPanel Grid.Column="2">
            <Border DockPanel.Dock="Top"
                    BorderThickness="5"
                    CornerRadius="5"
                    Background="#FF465A7D">
                <Border.Effect>
                    <DropShadowEffect Color="#FFB6B6B6"/>
                </Border.Effect>
                <HeaderedContentControl Header="{x:Static t:Messages.Gb_Doctors}"
                                  Height="300">
                    <ScrollViewer VerticalScrollBarVisibility="Auto"
                                  HorizontalScrollBarVisibility="Auto">
                        <ItemsControl ItemsSource="{Binding Doctors}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <ctrl:DoctorView/>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </HeaderedContentControl>
            </Border>
            <Border DockPanel.Dock="Top"
                    BorderThickness="5"
                    CornerRadius="5"
                    Background="#FF465A7D">
                <Border.Effect>
                    <DropShadowEffect Color="#FFB6B6B6"/>
                </Border.Effect>
                <HeaderedContentControl Header="{x:Static t:Messages.Gb_Notes}">
                    <TextBox Text="{Binding Reason}"
                             Margin="4"
                             VerticalScrollBarVisibility="Visible"
                             HorizontalScrollBarVisibility="Auto"
                             TextWrapping="Wrap"
                             IsReadOnly="True" 
                             AcceptsReturn="True" />
                </HeaderedContentControl>
            </Border>
        </DockPanel>
    </Grid>
</UserControl>
